<?

class MailController extends Controller{
    
    function actionIndex(){
        $this->actionList();
    }
    
    function actionList(){
        echo 'list';
    }
    
    function actionImport(){
        
        $pop3 = new POP3();
        
        $pop3->pUSERPASS('task@rrevin.ru','DHAzsYFS');
        if($pop3->error){echo 'ERROR: '.$pop3->error; exit(0); }
        
        $messages = $pop3->pLIST();
        
        foreach($messages as $k=>$v){
            $params['include_bodies'] = true;
            $params['decode_bodies']  = false;
            $params['decode_headers'] = true;
            $params['input']          = $pop3->pRETR($k);
            $params['crlf']           = "\r\n";
            
            $structure = Mail_mimeDecode::decode($params);
            
            echo debug($structure);
        }
        
        $pop3->pQUIT();
        
    }
    
}
